﻿//反填

$(function () {
    fantian1();

})
//反填采购消息
function fantian1() {
    // 发送AJAX请求获取数据
    console.log(localStorage.getItem("purchaseID"))
    $.ajax({
        type: "get",
        url: "/Purch/FabPurch",
        data: {
            PurchaseID: localStorage.getItem("purchaseID"),
            token: localStorage.getItem("token")
        },
        success: function (res) {
            var ter = JSON.parse(res)
            console.log(ter.data)

            $(ter.data).each(function () {
                localStorage.setItem("purchaseID", this.purchaseID)
                $('#purchaseCode').val(this.purchaseCode);
                $('#ingredient').val(this.ingredientnumber);
                $('#ingredientName').val(this.ingredientName);
                $('#purchaseNumber').val(this.purchaseNumber);
               //// form.render('select')//重新渲染下拉
               // $("[#purchaseSpecification]").val(this.purchaseSpecification);
               //// form.render('select')//重新渲染下拉

                // $("[#purchaseSize").val(this.purchaseSize);
                $("select[name='purchaseSpecification']").val(this.purchaseSpecification);
                //$("[name='purchaseSpecification'][value='" + this.purchaseSpecification + "']").prop("checked", true);
                $("[name='purchaseSize'][value='" + this.purchaseSize + "']").prop("checked", true);
                $('#purchaseDate').val(this.purchaseDate.substring(0, 10));
                $('#purchaseBudget').val(this.purchaseBudget);
                $('#purchaseBatch').val(this.purchaseBatch);

            })

        },

    });


}

